﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace Project.Migrations
{
    public partial class InitialCreate2 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Stk_WorkStockOutBills",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    DepartmentId = table.Column<long>(nullable: false),
                    DepartmentName = table.Column<string>(nullable: true),
                    SupplierEmployeeId = table.Column<long>(nullable: false),
                    SupplierEmployeeName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Stk_WorkStockOutBills", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Stk_WorkStockOutBillDetails",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    BillId = table.Column<long>(nullable: false),
                    Number = table.Column<decimal>(nullable: false),
                    Price = table.Column<decimal>(nullable: false),
                    WarehouseId = table.Column<long>(nullable: false),
                    WarehouseName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Stk_WorkStockOutBillDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Stk_WorkStockOutBillDetails_Stk_WorkStockOutBills_BillId",
                        column: x => x.BillId,
                        principalTable: "Stk_WorkStockOutBills",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Stk_WorkStockOutBillDetails_BillId",
                table: "Stk_WorkStockOutBillDetails",
                column: "BillId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Stk_WorkStockOutBillDetails");

            migrationBuilder.DropTable(
                name: "Stk_WorkStockOutBills");
        }
    }
}
